
package com.fly.demo.entity;

import java.util.Date;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import com.ketayao.ketacustom.entity.Idable;
import com.vladmihalcea.hibernate.type.json.JsonStringType;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(description = "用户数据对象")
@Entity
@Table(name = "user")
@TypeDef(name = "json", typeClass = JsonStringType.class)
public class User2 implements Idable<Long>
{
    @ApiModelProperty(hidden = true)
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    
    /**
     * 年龄
     */
    @ApiModelProperty(value = "年龄", required = true, example = "18")
    @NotNull(message = "年龄不能为空")
    @Range(min = 10, max = 80, message = "年龄必须在{min}-{max}")
    @Column(name = "age", length = 10)
    private Integer age;
    
    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名", required = true, example = "青哥")
    @NotBlank
    @Column(name = "name", length = 255)
    private String name;
    
    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名", required = true, example = "xiaomin")
    @NotBlank(message = "username不能为空")
    @Column(name = "username", nullable = false, length = 20)
    private String username;
    
    /**
     * 密码
     */
    @ApiModelProperty(value = "密码", required = true, example = "password123456")
    @NotBlank(message = "password不能为空")
    @Column(name = "password", nullable = false, length = 20)
    private String password;
    
    /**
     * 是否启用
     */
    @ApiModelProperty(value = "是否启用", example = "1")
    @Column(name = "enabled", length = 1)
    private Boolean enabled;
    
    /**
     * 创建时间
     */
    @ApiModelProperty(hidden = true)
    @Column(name = "create_date", length = 19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    
    /**
     * 备注
     */
    @Type(type = "json")
    @ApiModelProperty(value = "备注, json数组", example = "{\"name\":\"青哥\",\"password\":\"password123456\",\"username\":\"小宜\"}")
    @Column(name = "comment", length = 200)
    private Map<String, String> comment;
    
    /**
     * @return the id
     */
    @Override
    public Long getId()
    {
        return id;
    }
    
    /**
     * @param id the id to set
     */
    @Override
    public void setId(Long id)
    {
        this.id = id;
    }
    
    /**
     * @param username the username to set
     */
    public void setUsername(String username)
    {
        this.username = username;
    }
    
    /**
     * @return the username
     */
    public String getUsername()
    {
        return this.username;
    }
    
    /**
     * @param password the password to set
     */
    public void setPassword(String password)
    {
        this.password = password;
    }
    
    /**
     * @return the password
     */
    public String getPassword()
    {
        return this.password;
    }
    
    /**
     * @param enabled the enabled to set
     */
    public void setEnabled(Boolean enabled)
    {
        this.enabled = enabled;
    }
    
    /**
     * @return the enabled
     */
    public Boolean isEnabled()
    {
        return this.enabled;
    }
    
    /**
     * @param createDate the createDate to set
     */
    public void setCreateDate(Date createDate)
    {
        this.createDate = createDate;
    }
    
    /**
     * @return the createDate
     */
    public Date getCreateDate()
    {
        return this.createDate;
    }
    
    /**
     * @param age the age to set
     */
    public void setAge(Integer age)
    {
        this.age = age;
    }
    
    /**
     * @return the age
     */
    public Integer getAge()
    {
        return this.age;
    }
    
    /**
     * @param name the name to set
     */
    public void setName(String name)
    {
        this.name = name;
    }
    
    /**
     * @return the name
     */
    public String getName()
    {
        return this.name;
    }
    
    /**
     * @param comment the comment to set
     */
    public void setComment(Map<String, String> comment)
    {
        this.comment = comment;
    }
    
    /**
     * @return the comment
     */
    public Map<String, String> getComment()
    {
        return this.comment;
    }
}
